jQuery(function($) {
	//loadData();
	
});
function changeChongzhiNum(obj){
	obj.value=obj.value.replace(/[^\d]/g,'') 
	var count = obj.value;
	if(count == "" || count == "0"){
		parent.window.$("#promptTxt").html("请输入正确的金币数量");
	}else{
		parent.window.$("#promptTxt").html("你好，您将给"+parent.window.$("#chongzhiDialog_userId").html()+"账户充值"+count+"个金币");
	}
}
function openChargeDialog(userId,goldCoinCount){
	$("#chongzhiDialog_userId").html(userId);
	$("#chongzhiDialog_goldCoinCount").html(goldCoinCount);
	$("#promptTxt").html("你好，您将给"+userId+"账户充值1个金币");
	$("#chongzhi_num").attr("onkeyup",window.frameElement.id+".contentWindow.changeChongzhiNum(this)")
	parent.window.Index.dialog({
		resizable: false,
		dialogClass: "no-close",
		width: '620',
		context:$("#chongzhiDialog").html(),
		modal: true,
		title: "<div class='widget-header'><h4 class='smaller'><i class='ace-icon fa fa-rmb yellow'></i> 玩家充值</h4></div>",
		title_html: true,
		buttons: [
			{
				html: "<i class='ace-icon glyphicon glyphicon-ok bigger-110'></i>&nbsp; 保存",
				"class" : "btn btn-primary btn-minier",
				click: function() {
					var count = parent.window.$("#chongzhi_num").val();
					if(count == "" || count == "0"){
						return;
					}
					$.ajax({
						type:"POST",
						url:ctx+"/admin/usermanager/chargeJB",
						data:"userId="+userId+"&count="+parent.window.$("#chongzhi_num").val(),
						cache:false,
						success:function(data){
							refreshPage();
						}
					});
					parent.window.$( this ).dialog( "close" );
				}
			}
			,
			{
				html: "<i class='ace-icon glyphicon glyphicon-remove bigger-110'></i>&nbsp; 取消",
				"class" : "btn btn-minier",
				click: function() {
					parent.window.$( this ).dialog( "close" );
				}
			}
		]
	});
}
function loadData(){
	var data = $("#playerQueryFOrm").serialize();
	if(!data && initAgentId){
		data = "agentId="+initAgentId;
	}
	$.ajax({
		type:"POST",
		url:dataUrl,
		data:data,
		cache:false,
		success:function(data){
			$("#context").html(data);
		}
	});
}
var returnTop = function(){
	initUserId = null;
	$('#queryInputAgentId').val('');
	refreshPage();
}

